function loadProjectClass(spanId, inputname, level, name){
	js.ajax(js.getajaxurl('getlist','index','cg'),{"name":name},function(s){
		var nowLevel = parseInt(level) + 1;
		var content = "<select style=\"width:99%\" class=\"inputs\" name=\""+inputname+"\" onchange=\"loadProjectClass('protype"+nowLevel+"','projecttype"+nowLevel+"','"+nowLevel+"',this.value)\">";
		content += "<option value=''>--请选择--</option>";
		$.each(s, function(i, field){
		    content += "<option value='"+field.name+"'>"+field.name+"</option>";
		});
		content += "</select>"; 
		$("#"+spanId).html(content);
	},'get,json',false,'');
}

$(function() {
	loadProjectClass("protype", "projecttype", 1, "");
});